<template>
  <div id="page">
    <button @click="fileSave">fileSave</button>
    <button @click="jsPdf">jsPdf</button>
    <button @click="rgbaster">rgbaster</button>
    <div style="background: rgb(179, 81, 130)">1</div>
  </div>
</template>

<script>
import { saveAs } from "file-saver";
import { jsPDF } from "jspdf";
import analyze from "rgbaster";
export default {
  mounted() {},
  methods: {
    fileSave() {
      var blob = new Blob(["Hello, world!"], {
        type: "text/plain;charset=utf-8",
      });
      saveAs(blob, "hello.xls");
    },
    jsPdf() {
      const doc = new jsPDF();

      doc.text("Hello world!", 110, 10);
      doc.save("a4.pdf");
    },
    async rgbaster() {
      const result = await analyze(
        "https://p3-passport.byteacctimg.com/img/user-avatar/0347846c61ca087a8f59f8e936d63a23~300x300.image"
      );
      console.log(result);
    },
  },
};
</script>
